/**
 * Copyright 2009-2011 xiaonei.com All right reserved.
 * This software is the confidential and proprietary information of Xiaonei.com ("Confidential Information"). 
 * You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the license agreement you entered into with Xiaonei.com.
 * Create by XiaoNeiAntiSpamTeam
 *
 */

package com.xiaonei.testice.testami.client.service;

import Ice.Communicator;
import Ice.ObjectAdapter;
import Ice.Util;
import IceBox.Service;

/**
 * @ClassName: AMIPrinterService
 * @Description: AMIPrinterService
 * @author shaohui.liu shaohui.liu@opi-corp.com
 * @date Jan 28, 2010 11:04:57 AM
 * 
 */
public class AMIPrinterService implements Service {

    private ObjectAdapter objectAdapter;

    /* (非 Javadoc)
     * <p>Title: start</p>
     * <p>Description: </p>
     * @param arg0
     * @param arg1
     * @param arg2
     * @see IceBox._ServiceOperationsNC#start(java.lang.String, Ice.Communicator, java.lang.String[])
    */
    @Override
    public void start(String name, Communicator co, String[] args) {
        objectAdapter = co.createObjectAdapter(name);
        AMIPrinterI amiPrinterI = new AMIPrinterI();
        objectAdapter.add(amiPrinterI, Util.stringToIdentity("AMIPrinter"));
        objectAdapter.activate();
    }

    /* (非 Javadoc)
     * <p>Title: stop</p>
     * <p>Description: </p>
     * @see IceBox._ServiceOperationsNC#stop()
    */
    @Override
    public void stop() {
        objectAdapter.deactivate();
        System.exit(0);
    }
}
